<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="style.css">
    <title>注册</title>
</head>
<body>
<table border="0">
    <form action="registered.php" method="post">
        <h1>注册</h1>
        账号:<input type="text" name="user"></br>
        密码:<input type="password" name="pass"></br>
        <input type="submit" value="注册"></br>
    </form>
</table>
</body>
</html>

<?php
include 'conn.php';
if($conn){
    if(isset($_POST['user'])&&isset($_POST['pass'])){
        $user=$_POST['user'];
        $pass=$_POST['pass'];
        $sql="insert into user (account,password) values('$user','$pass');";
        if(mysqli_query($conn,$sql)){
            // echo "<script>window.alert('注册成功');<script>";
            header('location:login.php');
        }else{
            echo "Error: " . $sql . "<br>" . mysqli_error($conn);
        }


    }
}
